﻿using HZU.ZP.Data.Interfaces.Resume;
using HZU.ZP.Domain.IService.Resume;
using HZU.ZP.Domain.Model.Resume;
using HZU.ZP.Domain.ServiceImpl.Mappers.Resume;
using System;
using System.Collections.Generic;
using System.Text;

namespace HZU.ZP.Domain.ServiceImpl.PCSvc.Resume
{
    public class SelfEvaluationService:ISelfEvaluationService
    {
        private SelfEvaluationMapper _mapper = new SelfEvaluationMapper();
        private ISelfEvaluationDao _sqlData;
        public SelfEvaluationService(ISelfEvaluationDao sqlData)
        {
            _sqlData = sqlData;
        }

        public bool AddSelfEvaluation(SelfEvaluation selfEvaluation)
        {
            var selfEvaDao = _mapper.MapToDao(selfEvaluation);
            _sqlData.AddSelfEvaluation(selfEvaDao);
            return true;
        }

        public bool DeleteSelfEvaluation(int id)
        {
            _sqlData.DeleteSelfEvaluation(id);
            return true;
        }

        public SelfEvaluation GetSelfEvaluation(int applicantId)
        {
            return _mapper.MapToDomain(_sqlData.GetSelfEvaluation(applicantId));
        }

        public bool UpdateSelfEvaluation(SelfEvaluation selfEvaluation)
        {
            var selfEvaDao = _mapper.MapToDao(selfEvaluation);
            _sqlData.UpdateSelfEvaluation(selfEvaDao);
            return true;
        }
    }
}
